<template>
  <div id="errorPage">
    <img class="error-image" src="../assets/404.png" alt="404 错误" />
    <h1>抱歉，这个页面已经被外星人绑架了~</h1>
    <p class="countdown">{{leftTimes}}秒钟后将带您<a href="/">返回地球</a></p>
  </div>
</template>

<script>
export default {
  name: 'NotFound',
  data() {
    return {
      leftTimes: 5,
      timer: null
    };
  },
  created() {
    this.timer = setInterval(() => {
      this.leftTimes--;
      if (this.leftTimes <= 0) {
        clearInterval(this.timer);
        this.$router.push('/');
      }
    }, 1000);
  },
  beforeUnmount() {
    if (this.timer) {
      clearInterval(this.timer);
    }
  }
}
</script>

<style scoped>
#errorPage {
  text-align: center;
  padding: 20px;
}
.error-image {
  max-width: 100%;
  height: auto;
  margin-bottom: 20px;
}
h1 {
  color: #333;
  margin: 20px 0;
  font-size: 24px;
}
.countdown {
  font-size: 16px;
  color: #666;
}
.countdown a {
  color: #2196F3;
  text-decoration: none;
}
.countdown a:hover {
  text-decoration: underline;
}
</style>